package com.eco.mam.work.request;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.InputStreamReader;

import org.apache.log4j.Logger;

import com.eco.mam.work.DataException;

public class WorkRequestProcessHelper {

	static final Logger logger = Logger
			.getLogger(WorkRequestProcessHelper.class);

	/* Opens the stream from csv file and returns the csv file as a BufferedReader */
	public static BufferedReader getWorkRequestAsCsv(String strCsvFileName) throws DataException {
		logger.info("Entering WorkRequestProcessHelper getWorkRequestAsCsv() method");
		BufferedReader bufferedReader = null;
		{
			try {
				InputStreamReader inputStreamReader = new InputStreamReader(
						(new FileInputStream(new File(strCsvFileName))));
				bufferedReader = new BufferedReader(inputStreamReader);

			} catch (FileNotFoundException e) {
				throw new DataException("No matching file  :"+strCsvFileName,e);

							}
			return bufferedReader;
		}

	}
}
